package com.woniu.tms.userInfo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.woniu.tms.entity.Classes;
import com.woniu.tms.entity.ClassesExample;
import com.woniu.tms.entity.User;
import com.woniu.tms.entity.UserExample;
import com.woniu.tms.entity.UserRoleExample.Criteria;
import com.woniu.tms.mapper.ClassesMapper;
import com.woniu.tms.mapper.UserMapper;
import com.woniu.tms.userInfo.service.UserInfoService;
@Service
public class UserInfoServiceImpl implements UserInfoService {
	@Autowired
	UserMapper userMapper;
	@Autowired
	ClassesMapper classesMapper;
	@Override
	public User findUserByuid(Integer uid) {
		// TODO Auto-generated method stub
		UserExample userExample=new UserExample();
		User user=userMapper.selectByPrimaryKey(uid);
		return user;
	}
	@Override
	public List<Classes> findAll() {
		// TODO Auto-generated method stub		
		ClassesExample classesExample=new ClassesExample();
		com.woniu.tms.entity.ClassesExample.Criteria criteria=classesExample.createCriteria();
		criteria.andCidIsNotNull();
		List<Classes> classesList=classesMapper.selectByExample(classesExample);
		return classesList;
	}
	@Override
	public Classes findByCid(Integer cid) {
		// TODO Auto-generated method stub
		ClassesExample classesExample=new ClassesExample();
		Classes classes=classesMapper.selectByPrimaryKey(cid);
		return classes;
	}
	@Override
	public void editUser(User user) {
		// TODO Auto-generated method stub
		userMapper.updateByPrimaryKey(user);
	}
	@Override
	public User findByUid(Integer uid) {
		// TODO Auto-generated method stub
		User user=userMapper.selectByPrimaryKey(uid);
		return user;
	}
	
}
